﻿using System.Collections.Generic;
using System.Data;
using DataLogical.TableClass;
using DBModule;

namespace DataLogical
{
    public class UserRole : tblUserRole
    {
        public UserRole(int _id)
            : base(_id)
        {
        }

        public UserRole() { }

        public static List<UserRole> GetRoleList(int _userID)
        {
            string strSQL = string.Format("SELECT ID FROM tblUserRole WHERE USER_ID = {0}", _userID);
            SqlModule db = CommonVar.s_SqlModule;
            DataTable dt = db.QueryBySql(strSQL);
            List<UserRole> _list = new List<UserRole>();
            foreach (DataRow dr in dt.Rows)
            {
                _list.Add(new UserRole(int.Parse(dr[0].ToString())));
            }
            return _list;
        }

        public static void DeleteUser(int _userID)
        {
            string strSQL = string.Format("DELETE tblUserRole WHERE USER_ID = {0}", _userID);
            SqlModule db = CommonVar.s_SqlModule;
            db.ExecSql(strSQL);
        }

    }
}
